package com.yy.dao.impl;

import com.yy.dao.GoodsDao;
import com.yy.db.GoodsDBUtil;
import com.yy.pojo.Goods;
import com.yy.pojo.ShoppingCart;
import com.yy.vo.Shopping;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class GoodsDaoImpl implements GoodsDao {
    @Override
    public List<Goods> getAllGoods() {
        GoodsDBUtil goodsDBUtil=new GoodsDBUtil();
        List<Goods> list = goodsDBUtil.getAllGoods();
        return list;
    }
    @Override
    public List<Goods> getGoodsByConditon(String condition) {
        GoodsDBUtil goodsDBUtil =new GoodsDBUtil();
        return goodsDBUtil.getGoodsByConditon(condition);
    }

    @Override
    public Goods getGoodsDetails(String gid) {
        GoodsDBUtil goodsDBUtil =new GoodsDBUtil();
        return goodsDBUtil.getGoodsDetails(gid);
    }

    @Override
    public boolean addShoppingCart(String gid, String num) {
        GoodsDBUtil goodsDBUtil =new GoodsDBUtil();
        return goodsDBUtil.addShoppingCart(gid,num);
    }

    @Override
    public List<Shopping> getShoppingCart() {
        GoodsDBUtil goodsDBUtil =new GoodsDBUtil();
        return goodsDBUtil.getShoppingCart();

    }
}
